package com.timi_licai.timi_licai_account.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.timi_licai.timi_licai_account.R;
import com.timi_licai.timi_licai_account.listener.EditDialogInterface;

/**
 * Created by Administrator on 2015/3/13.
 */
public class EditDialog extends Dialog implements View.OnClickListener {
    private Context context;
    private EditDialogInterface listener;
    private TextView btnCancel;
    private TextView btnConfirm;
    private EditText inputEdit;

    public EditDialog(Context context) {
        super(context);
        this.context = context;
    }

    public EditDialog(Context context, int theme, EditDialogInterface listener) {
        super(context, theme);
        this.listener = listener;
        this.context = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_discription);
        btnCancel = (TextView) findViewById(R.id.dialog_cancel);
        btnConfirm = (TextView) findViewById(R.id.dialog_confirm);
        inputEdit = (EditText) findViewById(R.id.dialog_edit_text);
        btnCancel.setOnClickListener(this);
        btnConfirm.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (listener != null) {
            listener.editDialogClick(id);
            String inputContent = inputEdit.getText().toString().trim();
            listener.editDialogInputContent(inputContent);
        }
    }
}
